{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfbase1.css?v={$version}"/>
</head>
<body>
<style type="text/css">
.pcfts{font: bold 14px/20px tahoma,verdana;color:#F60;vertical-align:middle;display:inline-block;margin-right:5px;margin-left:-14px;}
</style>
<div class="layui-fluid layui-form">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm12">
            <div class="layui-card" style="padding:15px;">
                    <div class="layui-card-body">
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:100px;"><b class="pcfts">*</b> 级别名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="level_name" class="layui-input" value="" lay-verify="required"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:100px;">每日免费发布</label>
                            <div class="layui-input-inline">
                                <input type="text" name="free_day_send" class="layui-input" value=""/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:100px;">共免费发布</label>
                            <div class="layui-input-inline">
                                <input type="text" name="free_all_send" class="layui-input" value=""/>
                            </div>
                        </div> 
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:100px;">每日下载数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="fee_day_top" class="layui-input" value=""/>
                            </div>
                        </div> 
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:100px;">共下载数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="fee_all_top" class="layui-input" value=""/>
                            </div>
                        </div>
                    </div>
            </div>
        </div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>  
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.msg('正在提交请勿刷新页面', {icon: 16,shade: 0.01,time:100000});
            $.ajax({
                type : 'post',
                url : "{:url('/users.userslevel/add')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.code == 1){
                        layer.msg(res.msg,{icon:1,time:1000},function(){
                            parent.window.location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll();
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
            return false;
        });
        
        
    });
</script>
</body>
</html>